package com.example.provider.service.Impl;

import java.util.List;

import com.example.common.model.UserFeedback;
import com.example.common.model.condition.UserFeedbackCondition;
import com.example.provider.mapper.UserFeedbackMapper;
import com.example.provider.service.UserFeedbackService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * Service接口实现
 *
 * @author bianj
 * @version 1.0.0 2021-05-09
 */
@Service
@Transactional(readOnly = true)
public class UserFeedbackServiceImpl extends ServiceImpl<UserFeedbackMapper, UserFeedback> implements UserFeedbackService {
    private static final Logger logger = LoggerFactory.getLogger(UserFeedbackService.class);

    @Override
    public IPage<UserFeedback> findUserFeedbackByCondition(UserFeedbackCondition condition) {
        IPage<UserFeedback> page = condition.buildPage();
        QueryWrapper<UserFeedback> queryWrapper = condition.buildQueryWrapper(UserFeedback.class);
        return this.page(page, queryWrapper);
    }

    @Override
    public UserFeedback getUserFeedbackById(Integer id) {
        return this.getById(id);
    }

    @Transactional
    @Override
    public boolean addUserFeedback(UserFeedback userFeedback) {
        return this.save(userFeedback);
    }

    @Transactional
    @Override
    public boolean updateUserFeedback(UserFeedback userFeedback) {
        return this.updateById(userFeedback);
    }

    @Transactional
    @Override
    public boolean deleteUserFeedbackById(Integer id) {
        return this.removeById(id);
    }

    @Transactional
    @Override
    public boolean deleteUserFeedbackByIds(List<Integer> idList) {
        return this.removeByIds(idList);
    }
}